<template>
    <div class="wh-100" style="background-color:#fff;">
        <!--头-->
        <div class="w-100 d-flex-between-center px-20" style="height: 60px;border-bottom: 1px solid #e8edf4">
            <div class="fs-16 fw-7">双选会公示</div>
            <Button style="width: 80px" @click="$router.back()">返回</Button>
        </div>

        <div class="px-20">
            <!-- 消息-->
            <div style="width: 900px;height: 40px;border:1px solid #fcf4eb;background-color:#fcf4eb;color:#ebb373;line-height: 40px " class="fs-14 px-12 mt-20">
                公示后，将以短信或站内信的方式群发给审核通过的企业
            </div>
            <div style="width: 900px;min-height:250px;border-radius: 10px;background-color:#ebf3fe; margin-top: 10px;padding-bottom: 10px;padding-top: 10px;color: rgba(0, 0, 0, 0.5);" class="">
                <div style="color: #4c4e4f;" class="fs-18  fw-6 ml-12">{{ title }}</div>
                <div class="ml-12 fs-14">
                    <div class="mt-12">双选会形式：{{ dataList.attendMethod }}</div>
                    <div class="mt-12">举办场地：{{ dataList.venue }}</div>
                    <div class="mt-12">召开时间：{{ dataList.activityStartTime }}</div>
                    <div class="mt-12">结束时间：{{ dataList.activityEndTime }}</div>
                    <div class="mt-12">
                        双选会企业:共{{ dataList.totalNumber }}家企业通过审核，请下载展位列表并确认您的展位位置,
                        <span style="color: #1677FF;cursor: pointer" @click="download">点此下载</span>
                    </div>
                </div>
            </div>
            <div class="mt-20">
                <div class="fs-16 fw-7 ">群发消息模版</div>
                <div class="mt-12">
                    <CheckboxGroup>
<!--                        <Checkbox v-model="pageParams.isSms" label="短信"></Checkbox>-->
                        <Checkbox v-model="pageParams.isInnerMessage" label="站内信"></Checkbox>
<!--                        <Checkbox v-model="pageParams.isWxMessage" label="微信公众号"></Checkbox>-->
                    </CheckboxGroup>
                </div>
                <div class="mt-12">
                    <div
                        type="textarea"
                        class="fs-14 d-flex-center"
                        style="width: 900px;height:100px;
                         border: 1px solid #e8edf4;border-radius: 4px;
                         padding: 15px;
                         
                         "
                        v-html="tip"
                    ></div>
                </div>
            </div>
            <div class="mt-20">
                <Button type="primary" @click="submit">确认公示</Button>
                <Button @click="$router.back()">取消</Button>
            </div>
        </div>
    </div>
</template>
<script>
import { publicityAPI, contentQueryAPI, saveForReviewAPI, exportAPI, downloadTheFileAPI } from '../../../api/bys/recruitmentManagement/index';
export default {
    data() {
        return {
            massMessaging: '',
            title: '',
            tip:
                ' <$企业名称>，您好!贵公司报名参加的"启航秋招季”-2024届高校毕业生综合类双选会(第五场 ) 审核已通过，请准时参加招会。招聘会召开时间: 2023年11月15日 09.:30至2023年11月15日 12.30，展位号为:<$企业展位号>，联系人: 王老师，电话：371-61179358。详情请登入<$平台名称>查看，谢谢 !',
            pageParams: {
                doubleElectionId: '',
                isSms: false,
                isInnerMessage: false,
                isWxMessage: false
            },
            doubleElectionId: '',
            dataList: {
                activityEndTime: '',
                activityStartTime: '',
                attendMethod: '',
                totalNumbe: 0,
                venue: ''
            }
        };
    },
    created() {},
    mounted() {
        this.doubleElectionId = this.$route.query.id;
        this.title = this.$route.query.title;
        this.pageParams.doubleElectionId = this.$route.query.id;
        this.getList();
    },
    methods: {
        download() {
            console.log(11111);
            downloadTheFileAPI({ doubleElectionId: this.doubleElectionId }).then(res => {
                this.importing1 = false;
                // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
                const blob = new Blob([res], { type: 'charset=utf-8' });
                let url = window.URL.createObjectURL(blob);

                const link = document.createElement('a');
                link.style.display = 'none';
                link.href = url;
                link.setAttribute('download', '参会企业展位信息.xlsx');
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link); // 删除节点
                window.URL.revokeObjectURL(url); //释放该 url
            });
        },
        submit() {
            this.$confirm('是否确定公示该双选会?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            })
                .then(() => {
                    publicityAPI(this.pageParams).then(res => {
                        if (res.success) {
                            this.$message({
                                type: 'success',
                                message: '公示成功'
                            });
                        }
                    });
                })
                .catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消公示'
                    });
                });
        },
        getList() {
            console.log(this.doubleElectionId);
            contentQueryAPI({
                doubleElectionId: this.doubleElectionId
            }).then(res => {
                console.log(res);
                this.dataList = res.result;
                this.tip = ' <$企业名称>，您好!贵公司报名参加的：'+ this.$route.query.title +  '审核已通过，请准时参加招会。双选会召开时间: '+ res.result.activityStartTime +  '至' + res.result.activityEndTime + '，展位号为:<$企业展位号>，联系人: '+ res.result.contactPerson +'，电话：'+ res.result.contactPhone +'。详情请登入<$平台名称>查看，谢谢 !'
            });
        }
    }
};
</script>
